package com.abel.bigwater.data

open class DataException : Exception {
    constructor() : super() {}
    constructor(msg: String) : super(msg) {}
    constructor(msg: String, cause: Throwable) : super(msg, cause)
}

/**
 * 无法识别的包类型，如包头不匹配，或者功能码不匹配等。应忽略该处内容，并根据数据长度消费字节。
 */
class UnknownPacketException : DataException {
    constructor() : super() {}
    constructor(msg: String) : super(msg) {}
    constructor(msg: String, cause: Throwable) : super(msg, cause)
}

/**
 * 已经匹配了包类型及功能码，但数据不正确的包, 应挂断重连。
 */
class InvalidPacketException : DataException {
    constructor() : super() {}
    constructor(msg: String) : super(msg) {}
    constructor(msg: String, cause: Throwable) : super(msg, cause)
}

/**
 * 数据不完整，已有数据均能正确解析. 应等待后续数据到来。
 */
class NotEnoughDataException : DataException {
    constructor() : super() {}
    constructor(msg: String) : super(msg) {}
    constructor(msg: String, cause: Throwable) : super(msg, cause)
}